<template>
  <div class="menuOperation">
    <t-poptip v-if="!true" confirm placement="top" title="确认启用状态吗？">
      <t-tooltip content="启用" placement="top">
        <t-icon type="play-circle-outline"></t-icon>
      </t-tooltip>
    </t-poptip>
    <t-poptip v-else confirm placement="top" title="确认禁用状态吗？">
      <t-tooltip content="禁用" placement="top">
        <t-icon type="pause-circle-outline"></t-icon>
      </t-tooltip>
    </t-poptip>
    <t-tooltip content="编辑" placement="top">
      <t-icon type="border-color" @click.native="edit"></t-icon>
    </t-tooltip>
    <t-poptip confirm placement="top" title="确认删除这条内容吗？" @on-ok="deleteConfirm">
      <t-tooltip content="删除" placement="top">
        <t-icon type="delete"></t-icon>
      </t-tooltip>
    </t-poptip>
    <t-tooltip content="配置" placement="top">
      <t-icon type="menu"></t-icon>
    </t-tooltip>
  </div>
</template>
<script>
export default {
  props: {
    auth: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {

    }
  },
  methods: {
    edit() {
      this.$router.push('/auth/editDataAuth/' + this.auth.ID)
    },
    // 确定删除
    deleteConfirm() {
      this.http.$http.post(this.services.DELETE_MENU_AUTH, {
        bo: 'user',
        bc: 'USER_FUNCTION',
        validation_method: 'com.wframe.usermanager.services.valid.FuncDeleteValid',
        condition: JSON.stringify({
          ID: this.auth.ID
        })
      }).then(res => {
        if (res.data.CODE === 0) {
          this.$Message.success('删除成功')
          this.$emit('deleteSuccess')
        } else {
          this.$Message.danger('删除失败')
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.menuOperation {
  i {
    cursor: pointer;
    margin-right: 10px;
    font-size: 16px;
    &:first-child {
      color: rgb(255, 99, 99);
    }
    &:nth-child(2) {
      color: rgb(50, 207, 154);
    }
  }
}
</style>

